using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Variables;
using UnityEngine;

namespace NodeCanvas.Actions
{
	[Category("✫ Blackboard")]
	[Description("Remove a number of game objects from the target list")]
	public class RemoveListObjects : ActionTask
	{
		[RequiredField]
		[BlackboardOnly]
		public BBGameObjectList targetList;

		public List<BBGameObject> objectsToRemove;

		protected override void OnExecute()
		{
			foreach (GameObject item in objectsToRemove.Select((BBGameObject bbGo) => bbGo.value))
			{
				targetList.value.Remove(item);
			}
			EndAction(true);
		}
	}
}
